package pe.com.slcsccy.aegis.model.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import pe.com.slcsccy.aegis.model.beans.RutaServicio;
import pe.com.slcsccy.aegis.model.beans.RutaServicioExample;
import pe.com.slcsccy.aegis.model.beans.RutaServicioKey;

import com.ibatis.sqlmap.client.SqlMapClient;


@Repository("rutaServicioDAO")
public class RutaServicioDAOImpl extends SqlMapClientDaoSupport implements RutaServicioDAO {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public RutaServicioDAOImpl() {
        super();
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int countByExample(RutaServicioExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("ruta_servicio.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int deleteByExample(RutaServicioExample example) {
        int rows = getSqlMapClientTemplate().delete("ruta_servicio.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int deleteByPrimaryKey(RutaServicioKey key) {
        int rows = getSqlMapClientTemplate().delete("ruta_servicio.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public void insert(RutaServicio record) {
        getSqlMapClientTemplate().insert("ruta_servicio.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public void insertSelective(RutaServicio record) {
        getSqlMapClientTemplate().insert("ruta_servicio.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    @SuppressWarnings("unchecked")
    public List<RutaServicio> selectByExample(RutaServicioExample example) {
        List<RutaServicio> list = getSqlMapClientTemplate().queryForList("ruta_servicio.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public RutaServicio selectByPrimaryKey(RutaServicioKey key) {
        RutaServicio record = (RutaServicio) getSqlMapClientTemplate().queryForObject("ruta_servicio.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int updateByExampleSelective(RutaServicio record, RutaServicioExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("ruta_servicio.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int updateByExample(RutaServicio record, RutaServicioExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("ruta_servicio.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int updateByPrimaryKeySelective(RutaServicio record) {
        int rows = getSqlMapClientTemplate().update("ruta_servicio.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    public int updateByPrimaryKey(RutaServicio record) {
        int rows = getSqlMapClientTemplate().update("ruta_servicio.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table ruta_servicio
     *
     * @ibatorgenerated Thu Jun 21 17:06:50 COT 2012
     */
    private static class UpdateByExampleParms extends RutaServicioExample {
        private Object record;

        public UpdateByExampleParms(Object record, RutaServicioExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
    

    @Autowired
    public void createSqlMapClient(@Qualifier("sqlMapClient")  SqlMapClient sqlMapClient){
      setSqlMapClient(sqlMapClient);
    }

    @Override
    public List<RutaServicio> selectListadoHorariosServicios(Map parametros) {
        List<RutaServicio> list = getSqlMapClientTemplate().queryForList("ruta_servicio.selectListadoHorariosServicios", parametros);
        return list;
    }
    
}


